
import React from 'react'
import './CateShow.less'
function CateShow(props) {
    console.log(props);
    let { leftlist, goodslist, n, changeRequest } = props
    return (
        <div className="cate">
            <div className="main">
                <div className="left">
                    {
                        leftlist.map((item, index) => (
                            <h5 key={item.id} className={index === n ? 'select' : ''} onClick={() => changeRequest(item.id, index)}>{item.catename}</h5>
                        ))
                    }

                </div>
                <div className="right">
                    <h3>热门精选</h3>
                    <ul>
                        {
                            goodslist.map(item => {
                                return (
                                    <li key={item.id} onClick={() => props.history.push('/detail/' + item.id + '/1')}>
                                        <div className="list_left">
                                            <img src={item.img} alt="" />
                                        </div>
                                        <div className="list_right">
                                            <p>{item.description}</p>
                                            <p>{item.goodsname}</p>
                                            <p>￥{item.price}</p>
                                            <del>￥{item.market_price}</del>
                                            <p>限购：{item.islimit}份</p>
                                        </div>

                                    </li>
                                )
                            })
                        }

                    </ul>
                </div>

            </div>
        </div>
    )
}
export default React.memo(CateShow)
